<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>

<blockquote class="layui-elem-quote"><{$action}></blockquote>

<form class="layui-form layui-form-pane" method="post" action="/question/add" id="form_add_role">
	<div class="layui-form-item">
		<label class="layui-form-label">科目</label>
		<div class="layui-input-block">
						<select name="subject_id" id="subject" lay-filter="subject">
							<option value="0">请选择科目</option>
							<{foreach from=$subject item=item}>
								<option value="<{$item.id}>" <{if $item.id == 1}>selected="selected"<{/if}>><{$item.title}></option>
							<{/foreach}>
						</select>
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">章节</label>
			<div class="layui-input-block">
				<input type="text" name="chapter_id" lay-verify="title" autocomplete="off" class="layui-input">
			</div>
	</div>

	<div class="layui-form-item">
			<label class="layui-form-label">题目类型</label>
			<div class="layui-input-block">
				<select name="type" lay-filter="q_type">
					<option value="1">单选题</option>
					<option value="2">多选题</option>
					<option value="3">判断题</option>
					<option value="4">计算分析题</option>
				</select>
			</div>
		</div>

	<div class="layui-form-item">
		<label class="layui-form-label">难度等级</label>
		<div class="layui-input-block">
			<input type="radio" name="difficulty_level" value="1" title="难">
			<input type="radio" name="difficulty_level" value="2" title="中" checked>
			<input type="radio" name="difficulty_level" value="3" title="易" >
		</div>
	</div>

	<div class="layui-form-item layui-form-text">
		<label class="layui-form-label">题目内容</label>
		<div class="layui-input-block">
			<textarea class="layui-textarea layui-hide" name="subject_text" lay-verify="content" id="editor"></textarea>
		</div>
	</div>

	<!--单选答案-->
	<div id="an_radio_box">
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案A</label>
				<div class="layui-input-block">
					<input type="text" name="an_radio_text[1]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>

			<div class="layui-inline">
				<input type="radio" name="an_radio" value="1" title="正确答案">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案B</label>
				<div class="layui-input-block">
					<input type="text" name="an_radio_text[2]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="radio" name="an_radio" value="2" title="正确答案">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案C</label>
				<div class="layui-input-block">
					<input type="text" name="an_radio_text[3]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="radio" name="an_radio" value="3" title="正确答案">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案D</label>
				<div class="layui-input-block">
					<input type="text" name="an_radio_text[4]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="radio" name="an_radio" value="4" title="正确答案">
			</div>
		</div>
	</div>

	<!--多选答案-->
	<div id="an_checkbox_box" style="display:none;">

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案A</label>
				<div class="layui-input-block">
					<input type="text" name="an_checkbox_text[1]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="checkbox" name="an_checkbox[]" value="1" title="正确答案">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案B</label>
				<div class="layui-input-block">
					<input type="text" name="an_checkbox_text[2]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="checkbox" name="an_checkbox[]" value="2" title="正确答案">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案C</label>
				<div class="layui-input-block">
					<input type="text" name="an_checkbox_text[3]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="checkbox" name="an_checkbox[]" value="3" title="正确答案">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案D</label>
				<div class="layui-input-block">
					<input type="text" name="an_checkbox_text[4]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="checkbox" name="an_checkbox[]" value="4" title="正确答案">
			</div>
		</div>

	</div>

	<!--选择题答案-->
	<div id="an_choice_box" style="display:none;">
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案A</label>
				<div class="layui-input-block">
					<input type="text" name="an_choice_text[1]" lay-verify="title" autocomplete="off" class="layui-input" value="对" disabled style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="radio" name="an_choice" value="1" title="正确答案">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">题目答案B</label>
				<div class="layui-input-block">
					<input type="text" name="an_choice_text[2]" lay-verify="title" autocomplete="off" class="layui-input" value="错" disabled style="width: 500px;">
				</div>
			</div>
			
			<div class="layui-inline">
				<input type="radio" name="an_choice" value="2" title="正确答案">
			</div>
		</div>
	</div>

	<div class="layui-input-block">
		<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>


<{include file="public_html/footer.html"}>
<script type="text/javascript">
	layui.use(['form','jquery'], function(){
		var form = layui.form(),$ = layui.jquery;
		

		form.on('select(q_type)', function(data){
			var type = $(data.elem).val();
			if(type == 1){
				$("#an_checkbox_box, #an_choice_box").hide();
				$("#an_radio_box").show();
			}else if(type == 2){
				$("#an_radio_box, #an_choice_box").hide();
				$("#an_checkbox_box").show();
			}else if(type == 3){
				$("#an_radio_box, #an_checkbox_box").hide();
				$("#an_choice_box").show();
			}
			
		});
	});
</script>